﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Home.Master" AutoEventWireup="true" CodeBehind="ListDepartment.aspx.cs" Inherits="TimeWork.ListDepartment" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Bredcrumb" runat="server">
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <form runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <div class="wrap_grid">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="GVListDepartment" runat="server" AutoGenerateColumns="False" 
                DataKeyNames="DepartmentID" 
                onrowcancelingedit="GVListDepartment_RowCancelingEdit" 
                onrowediting="GVListDepartment_RowEditing" 
                onrowupdating="GVListDepartment_RowUpdating" 
                            onrowdeleting="GVListDepartment_RowDeleting">
                <Columns>
                    <asp:TemplateField HeaderText="STT" HeaderStyle-HorizontalAlign="Left" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                        <ItemTemplate>
                            <%# Container.DataItemIndex + 1 %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tên phòng" HeaderStyle-HorizontalAlign="Left" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDepartmentName" runat="server" Text='<%# Bind("DepartmentName") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblDepartmentName" Text='<%# Bind("DepartmentName") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Viết tắt" HeaderStyle-HorizontalAlign="Left" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDepartmentNameAlt" runat="server" Text='<%# Bind("DepartmentNameAlt") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblDepartmentNameAlt" Text='<%# Bind("DepartmentNameAlt") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Mô tả" HeaderStyle-HorizontalAlign="Left" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDepartmentDescription" runat="server" Text='<%# Bind("DepartmentDescription") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblDepartmentDescription" Text='<%# Bind("DepartmentDescription") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
                        <EditItemTemplate>
                            <asp:ImageButton ID="imgUpdate" runat="server" CausesValidation="true" CommandName="Update" ImageUrl="~/resources/img/icons/update.png"  ToolTip="Cập nhật" CssClass="wrap_input"></asp:ImageButton>
                            <asp:ImageButton ID="imgCancel" runat="server" CausesValidation="false" CommandName="Cancel" ImageUrl="~/resources/img/icons/cancel.png"  ToolTip="Hủy" CssClass="wrap_input"></asp:ImageButton>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:ImageButton ID="imgEdit" runat="server" CausesValidation="false" CommandName="Edit" ImageUrl="~/resources/img/icons/page_white_edit.png" ToolTip="Sửa" CssClass="wrap_input"></asp:ImageButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:ImageButton ID="imgDelete" runat="server" CausesValidation="true" CommandName="Delete" Text="Xóa" ImageUrl="~/resources/img/icons/delete.png"  ToolTip="Xóa" CssClass="wrap_input" OnClientClick="return confirm('Bạn chắc chắn muốn xóa phòng này?');"></asp:ImageButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <div class="insert_item">
                    <table>
                        <tr>
                            <td>Tên phòng *</td>
                            <td><asp:TextBox ID="txtName" runat="server" ViewStateMode="Disabled"></asp:TextBox>
                            <asp:Label ID="lblName" runat="server" CssClass="validate"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>Viết tắt *</td>
                            <td><asp:TextBox ID="txtNameAlt" runat="server" ViewStateMode="Disabled"></asp:TextBox>
                                <asp:Label ID="lblErrorNameAlt" runat="server" CssClass="validate"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>Mô tả</td>
                            <td><asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Columns="30" Rows="5"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Button ID="BtnAdd" runat="server" Text="Thêm" onclick="BtnAdd_Click" />&nbsp;<input type="reset" value="Hủy" />
                            </td>
                            <td>
                                <asp:UpdateProgress ID="UpdateProgress1" runat="server" 
                                    AssociatedUpdatePanelID="UpdatePanel1">
                                    <ProgressTemplate>
                                        <img alt="Đang xử lý" src="~/resources/img/icons/loading.gif" /> 
                                    </ProgressTemplate>
                                </asp:UpdateProgress>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            
            
        </form>
</asp:Content>
